﻿using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;

namespace HalconDotNet
{
	/// <summary>Represents an instance of a Gaussian mixture model.</summary>
	// Token: 0x02000021 RID: 33
	[Serializable]
	public class HClassGmm : HHandle, ISerializable, ICloneable
	{
		// Token: 0x0600027D RID: 637 RVA: 0x0000883B File Offset: 0x00006A3B
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassGmm() : base(HHandleBase.UNDEF)
		{
		}

		// Token: 0x0600027E RID: 638 RVA: 0x0000FC42 File Offset: 0x0000DE42
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassGmm(IntPtr handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x0600027F RID: 639 RVA: 0x0000FC51 File Offset: 0x0000DE51
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassGmm(HHandle handle) : base(handle)
		{
			this.AssertSemType();
		}

		// Token: 0x06000280 RID: 640 RVA: 0x0000FC60 File Offset: 0x0000DE60
		private void AssertSemType()
		{
			base.AssertSemType("class_gmm");
		}

		// Token: 0x06000281 RID: 641 RVA: 0x0000FC6D File Offset: 0x0000DE6D
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassGmm obj)
		{
			obj = new HClassGmm(HHandleBase.UNDEF);
			return obj.Load(proc, parIndex, err);
		}

		// Token: 0x06000282 RID: 642 RVA: 0x0000FC88 File Offset: 0x0000DE88
		internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassGmm[] obj)
		{
			HTuple htuple;
			err = HTuple.LoadNew(proc, parIndex, err, out htuple);
			obj = new HClassGmm[htuple.Length];
			for (int i = 0; i < htuple.Length; i++)
			{
				obj[i] = new HClassGmm(HalconAPI.IsLegacyHandleMode() ? htuple[i].IP : htuple[i].H);
			}
			htuple.Dispose();
			return err;
		}

		/// <summary>
		///   Read a Gaussian Mixture Model from a file.
		///   Modified instance represents: GMM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000283 RID: 643 RVA: 0x0000FCF8 File Offset: 0x0000DEF8
		public HClassGmm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1828);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a Gaussian Mixture Model for classification
		///   Modified instance represents: GMM handle.
		/// </summary>
		/// <param name="numDim">Number of dimensions of the feature space. Default: 3</param>
		/// <param name="numClasses">Number of classes of the GMM. Default: 5</param>
		/// <param name="numCenters">Number of centers per class. Default: 1</param>
		/// <param name="covarType">Type of the covariance matrices. Default: "spherical"</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "normalization"</param>
		/// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization'). Default: 10</param>
		/// <param name="randSeed">Seed value of the random number generator that is used to initialize the GMM with random values. Default: 42</param>
		// Token: 0x06000284 RID: 644 RVA: 0x0000FD44 File Offset: 0x0000DF44
		public HClassGmm(int numDim, int numClasses, HTuple numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
		{
			IntPtr proc = HalconAPI.PreCall(1840);
			HalconAPI.StoreI(proc, 0, numDim);
			HalconAPI.StoreI(proc, 1, numClasses);
			HalconAPI.Store(proc, 2, numCenters);
			HalconAPI.StoreS(proc, 3, covarType);
			HalconAPI.StoreS(proc, 4, preprocessing);
			HalconAPI.StoreI(proc, 5, numComponents);
			HalconAPI.StoreI(proc, 6, randSeed);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numCenters);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a Gaussian Mixture Model for classification
		///   Modified instance represents: GMM handle.
		/// </summary>
		/// <param name="numDim">Number of dimensions of the feature space. Default: 3</param>
		/// <param name="numClasses">Number of classes of the GMM. Default: 5</param>
		/// <param name="numCenters">Number of centers per class. Default: 1</param>
		/// <param name="covarType">Type of the covariance matrices. Default: "spherical"</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "normalization"</param>
		/// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization'). Default: 10</param>
		/// <param name="randSeed">Seed value of the random number generator that is used to initialize the GMM with random values. Default: 42</param>
		// Token: 0x06000285 RID: 645 RVA: 0x0000FDCC File Offset: 0x0000DFCC
		public HClassGmm(int numDim, int numClasses, int numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
		{
			IntPtr proc = HalconAPI.PreCall(1840);
			HalconAPI.StoreI(proc, 0, numDim);
			HalconAPI.StoreI(proc, 1, numClasses);
			HalconAPI.StoreI(proc, 2, numCenters);
			HalconAPI.StoreS(proc, 3, covarType);
			HalconAPI.StoreS(proc, 4, preprocessing);
			HalconAPI.StoreI(proc, 5, numComponents);
			HalconAPI.StoreI(proc, 6, randSeed);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		// Token: 0x06000286 RID: 646 RVA: 0x0000FE4C File Offset: 0x0000E04C
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = this.SerializeClassGmm();
			byte[] value = hserializedItem;
			hserializedItem.Dispose();
			info.AddValue("data", value, typeof(byte[]));
		}

		// Token: 0x06000287 RID: 647 RVA: 0x0000FE84 File Offset: 0x0000E084
		[EditorBrowsable(EditorBrowsableState.Never)]
		public HClassGmm(SerializationInfo info, StreamingContext context)
		{
			HSerializedItem hserializedItem = new HSerializedItem((byte[])info.GetValue("data", typeof(byte[])));
			this.DeserializeClassGmm(hserializedItem);
			hserializedItem.Dispose();
		}

		/// <summary>Serialize object to binary stream in HALCON format</summary>
		// Token: 0x06000288 RID: 648 RVA: 0x0000FEC4 File Offset: 0x0000E0C4
		public new void Serialize(Stream stream)
		{
			HSerializedItem hserializedItem = this.SerializeClassGmm();
			hserializedItem.Serialize(stream);
			hserializedItem.Dispose();
		}

		/// <summary>Deserialize object from binary stream in HALCON format</summary>
		// Token: 0x06000289 RID: 649 RVA: 0x0000FED8 File Offset: 0x0000E0D8
		public new static HClassGmm Deserialize(Stream stream)
		{
			HClassGmm hclassGmm = new HClassGmm();
			HSerializedItem hserializedItem = HSerializedItem.Deserialize(stream);
			hclassGmm.DeserializeClassGmm(hserializedItem);
			hserializedItem.Dispose();
			return hclassGmm;
		}

		// Token: 0x0600028A RID: 650 RVA: 0x0000FEFE File Offset: 0x0000E0FE
		object ICloneable.Clone()
		{
			return this.Clone();
		}

		// Token: 0x0600028B RID: 651 RVA: 0x0000FF08 File Offset: 0x0000E108
		public new HClassGmm Clone()
		{
			HSerializedItem hserializedItem = this.SerializeClassGmm();
			HClassGmm hclassGmm = new HClassGmm();
			hclassGmm.DeserializeClassGmm(hserializedItem);
			hserializedItem.Dispose();
			return hclassGmm;
		}

		/// <summary>
		///   Classify an image with a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="image">Input image.</param>
		/// <param name="rejectionThreshold">Threshold for the rejection of the classification. Default: 0.5</param>
		/// <returns>Segmented classes.</returns>
		// Token: 0x0600028C RID: 652 RVA: 0x0000FF30 File Offset: 0x0000E130
		public HRegion ClassifyImageClassGmm(HImage image, double rejectionThreshold)
		{
			IntPtr proc = HalconAPI.PreCall(431);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.StoreD(proc, 1, rejectionThreshold);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HRegion result;
			num = HRegion.LoadNew(proc, 1, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			return result;
		}

		/// <summary>
		///   Add training samples from an image to the training data of a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="image">Training image.</param>
		/// <param name="classRegions">Regions of the classes to be trained.</param>
		/// <param name="randomize">Standard deviation of the Gaussian noise added to the training data. Default: 0.0</param>
		// Token: 0x0600028D RID: 653 RVA: 0x0000FF90 File Offset: 0x0000E190
		public void AddSamplesImageClassGmm(HImage image, HRegion classRegions, double randomize)
		{
			IntPtr proc = HalconAPI.PreCall(432);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, image);
			HalconAPI.Store(proc, 2, classRegions);
			HalconAPI.StoreD(proc, 1, randomize);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(image);
			GC.KeepAlive(classRegions);
		}

		/// <summary>
		///   Get the training data of a Gaussian Mixture Model (GMM).
		///   Instance represents: Handle of a GMM that contains training data.
		/// </summary>
		/// <returns>Handle of the training data of the classifier.</returns>
		// Token: 0x0600028E RID: 654 RVA: 0x0000FFE8 File Offset: 0x0000E1E8
		public HClassTrainData GetClassTrainDataGmm()
		{
			IntPtr proc = HalconAPI.PreCall(1785);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HClassTrainData result;
			num = HClassTrainData.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Add training data to a Gaussian Mixture Model (GMM).
		///   Instance represents: Handle of a GMM which receives the training data.
		/// </summary>
		/// <param name="classTrainDataHandle">Handle of training data for a classifier.</param>
		// Token: 0x0600028F RID: 655 RVA: 0x00010030 File Offset: 0x0000E230
		public void AddClassTrainDataGmm(HClassTrainData classTrainDataHandle)
		{
			IntPtr proc = HalconAPI.PreCall(1786);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, classTrainDataHandle);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
		}

		/// <summary>
		///   Selects an optimal combination from a set of features to classify the  provided data.
		///   Modified instance represents: A trained GMM classifier using only the selected  features.
		/// </summary>
		/// <param name="classTrainDataHandle">Handle of the training data.</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="genParamName">Names of generic parameters to configure  the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure  the classifier. Default: []</param>
		/// <param name="score">The achieved score using two-fold cross-validation.</param>
		/// <returns>The selected feature set, contains indices or names.</returns>
		// Token: 0x06000290 RID: 656 RVA: 0x00010074 File Offset: 0x0000E274
		public HTuple SelectFeatureSetGmm(HClassTrainData classTrainDataHandle, string selectionMethod, HTuple genParamName, HTuple genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1801);
			HalconAPI.Store(proc, 0, classTrainDataHandle);
			HalconAPI.StoreS(proc, 1, selectionMethod);
			HalconAPI.Store(proc, 2, genParamName);
			HalconAPI.Store(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
			return result;
		}

		/// <summary>
		///   Selects an optimal combination from a set of features to classify the  provided data.
		///   Modified instance represents: A trained GMM classifier using only the selected  features.
		/// </summary>
		/// <param name="classTrainDataHandle">Handle of the training data.</param>
		/// <param name="selectionMethod">Method to perform the selection. Default: "greedy"</param>
		/// <param name="genParamName">Names of generic parameters to configure  the classifier. Default: []</param>
		/// <param name="genParamValue">Values of generic parameters to configure  the classifier. Default: []</param>
		/// <param name="score">The achieved score using two-fold cross-validation.</param>
		/// <returns>The selected feature set, contains indices or names.</returns>
		// Token: 0x06000291 RID: 657 RVA: 0x00010114 File Offset: 0x0000E314
		public HTuple SelectFeatureSetGmm(HClassTrainData classTrainDataHandle, string selectionMethod, string genParamName, double genParamValue, out HTuple score)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1801);
			HalconAPI.Store(proc, 0, classTrainDataHandle);
			HalconAPI.StoreS(proc, 1, selectionMethod);
			HalconAPI.StoreS(proc, 2, genParamName);
			HalconAPI.StoreD(proc, 3, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HTuple result;
			num = HTuple.LoadNew(proc, 1, num, out result);
			num = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num, out score);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(classTrainDataHandle);
			return result;
		}

		/// <summary>
		///   Create a look-up table using a gaussian mixture model to classify byte images.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="genParamName">Names of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <param name="genParamValue">Values of the generic parameters that can be adjusted for the LUT classifier creation. Default: []</param>
		/// <returns>Handle of the LUT classifier.</returns>
		// Token: 0x06000292 RID: 658 RVA: 0x000101A8 File Offset: 0x0000E3A8
		public HClassLUT CreateClassLutGmm(HTuple genParamName, HTuple genParamValue)
		{
			IntPtr proc = HalconAPI.PreCall(1820);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, genParamName);
			HalconAPI.Store(proc, 2, genParamValue);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(genParamName);
			HalconAPI.UnpinTuple(genParamValue);
			HClassLUT result;
			num = HClassLUT.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>Clear a Gaussian Mixture Model.</summary>
		/// <param name="GMMHandle">GMM handle.</param>
		// Token: 0x06000293 RID: 659 RVA: 0x0001020C File Offset: 0x0000E40C
		public static void ClearClassGmm(HClassGmm[] GMMHandle)
		{
			HTuple htuple = HHandleBase.ConcatArray(GMMHandle);
			IntPtr proc = HalconAPI.PreCall(1824);
			HalconAPI.Store(proc, 0, htuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(GMMHandle);
		}

		/// <summary>
		///   Clear a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		// Token: 0x06000294 RID: 660 RVA: 0x00010250 File Offset: 0x0000E450
		public void ClearClassGmm()
		{
			IntPtr proc = HalconAPI.PreCall(1824);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>Clear the training data of a Gaussian Mixture Model.</summary>
		/// <param name="GMMHandle">GMM handle.</param>
		// Token: 0x06000295 RID: 661 RVA: 0x00010284 File Offset: 0x0000E484
		public static void ClearSamplesClassGmm(HClassGmm[] GMMHandle)
		{
			HTuple htuple = HHandleBase.ConcatArray(GMMHandle);
			IntPtr proc = HalconAPI.PreCall(1825);
			HalconAPI.Store(proc, 0, htuple);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(htuple);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(GMMHandle);
		}

		/// <summary>
		///   Clear the training data of a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		// Token: 0x06000296 RID: 662 RVA: 0x000102C8 File Offset: 0x0000E4C8
		public void ClearSamplesClassGmm()
		{
			IntPtr proc = HalconAPI.PreCall(1825);
			base.Store(proc, 0);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Deserialize a serialized Gaussian Mixture Model.
		///   Modified instance represents: GMM handle.
		/// </summary>
		/// <param name="serializedItemHandle">Handle of the serialized item.</param>
		// Token: 0x06000297 RID: 663 RVA: 0x000102FC File Offset: 0x0000E4FC
		public void DeserializeClassGmm(HSerializedItem serializedItemHandle)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1826);
			HalconAPI.Store(proc, 0, serializedItemHandle);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			GC.KeepAlive(serializedItemHandle);
		}

		/// <summary>
		///   Serialize a Gaussian Mixture Model (GMM).
		///   Instance represents: GMM handle.
		/// </summary>
		/// <returns>Handle of the serialized item.</returns>
		// Token: 0x06000298 RID: 664 RVA: 0x00010350 File Offset: 0x0000E550
		public HSerializedItem SerializeClassGmm()
		{
			IntPtr proc = HalconAPI.PreCall(1827);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HSerializedItem result;
			num = HSerializedItem.LoadNew(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Read a Gaussian Mixture Model from a file.
		///   Modified instance represents: GMM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x06000299 RID: 665 RVA: 0x00010398 File Offset: 0x0000E598
		public void ReadClassGmm(string fileName)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1828);
			HalconAPI.StoreS(proc, 0, fileName);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write a Gaussian Mixture Model to a file.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x0600029A RID: 666 RVA: 0x000103E4 File Offset: 0x0000E5E4
		public void WriteClassGmm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1829);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Read the training data of a Gaussian Mixture Model from a file.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x0600029B RID: 667 RVA: 0x00010420 File Offset: 0x0000E620
		public void ReadSamplesClassGmm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1830);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Write the training data of a Gaussian Mixture Model to a file.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="fileName">File name.</param>
		// Token: 0x0600029C RID: 668 RVA: 0x0001045C File Offset: 0x0000E65C
		public void WriteSamplesClassGmm(string fileName)
		{
			IntPtr proc = HalconAPI.PreCall(1831);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, fileName);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Calculate the class of a feature vector by a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="features">Feature vector.</param>
		/// <param name="num">Number of best classes to determine. Default: 1</param>
		/// <param name="classProb">A-posteriori probability of the classes.</param>
		/// <param name="density">Probability density of the feature vector.</param>
		/// <param name="KSigmaProb">Normalized k-sigma-probability for the feature vector.</param>
		/// <returns>Result of classifying the feature vector with the GMM.</returns>
		// Token: 0x0600029D RID: 669 RVA: 0x00010498 File Offset: 0x0000E698
		public HTuple ClassifyClassGmm(HTuple features, int num, out HTuple classProb, out HTuple density, out HTuple KSigmaProb)
		{
			IntPtr proc = HalconAPI.PreCall(1832);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.StoreI(proc, 2, num);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			int num2 = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HTuple result;
			num2 = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, num2, out result);
			num2 = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num2, out classProb);
			num2 = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, num2, out density);
			num2 = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, num2, out KSigmaProb);
			HalconAPI.PostCall(proc, num2);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Evaluate a feature vector by a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="features">Feature vector.</param>
		/// <param name="density">Probability density of the feature vector.</param>
		/// <param name="KSigmaProb">Normalized k-sigma-probability for the feature vector.</param>
		/// <returns>A-posteriori probability of the classes.</returns>
		// Token: 0x0600029E RID: 670 RVA: 0x00010534 File Offset: 0x0000E734
		public HTuple EvaluateClassGmm(HTuple features, out double density, out double KSigmaProb)
		{
			IntPtr proc = HalconAPI.PreCall(1833);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			num = HalconAPI.LoadD(proc, 1, num, out density);
			num = HalconAPI.LoadD(proc, 2, num, out KSigmaProb);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Train a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="maxIter">Maximum number of iterations of the expectation maximization algorithm Default: 100</param>
		/// <param name="threshold">Threshold for relative change of the error for the expectation maximization algorithm to terminate. Default: 0.001</param>
		/// <param name="classPriors">Mode to determine the a-priori probabilities of the classes Default: "training"</param>
		/// <param name="regularize">Regularization value for preventing covariance matrix singularity. Default: 0.0001</param>
		/// <param name="iter">Number of executed iterations per class</param>
		/// <returns>Number of found centers per class</returns>
		// Token: 0x0600029F RID: 671 RVA: 0x000105B0 File Offset: 0x0000E7B0
		public HTuple TrainClassGmm(int maxIter, double threshold, string classPriors, double regularize, out HTuple iter)
		{
			IntPtr proc = HalconAPI.PreCall(1834);
			base.Store(proc, 0);
			HalconAPI.StoreI(proc, 1, maxIter);
			HalconAPI.StoreD(proc, 2, threshold);
			HalconAPI.StoreS(proc, 3, classPriors);
			HalconAPI.StoreD(proc, 4, regularize);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.INTEGER, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, num, out iter);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Compute the information content of the preprocessed feature vectors of a GMM.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "principal_components"</param>
		/// <param name="cumInformationCont">Cumulative information content of the transformed feature vectors.</param>
		/// <returns>Relative information content of the transformed feature vectors.</returns>
		// Token: 0x060002A0 RID: 672 RVA: 0x00010630 File Offset: 0x0000E830
		public HTuple GetPrepInfoClassGmm(string preprocessing, out HTuple cumInformationCont)
		{
			IntPtr proc = HalconAPI.PreCall(1835);
			base.Store(proc, 0);
			HalconAPI.StoreS(proc, 1, preprocessing);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			num = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, num, out cumInformationCont);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return the number of training samples stored in the training data of a Gaussian Mixture Model (GMM).
		///   Instance represents: GMM handle.
		/// </summary>
		/// <returns>Number of stored training samples.</returns>
		// Token: 0x060002A1 RID: 673 RVA: 0x00010694 File Offset: 0x0000E894
		public int GetSampleNumClassGmm()
		{
			IntPtr proc = HalconAPI.PreCall(1836);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Return a training sample from the training data of a Gaussian Mixture Models (GMM).
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="numSample">Index of the stored training sample.</param>
		/// <param name="classID">Class of the training sample.</param>
		/// <returns>Feature vector of the training sample.</returns>
		// Token: 0x060002A2 RID: 674 RVA: 0x000106DC File Offset: 0x0000E8DC
		public HTuple GetSampleClassGmm(int numSample, out int classID)
		{
			IntPtr proc = HalconAPI.PreCall(1837);
			base.Store(proc, 0);
			HalconAPI.StoreI(proc, 1, numSample);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			int num = HalconAPI.CallProcedure(proc);
			HTuple result;
			num = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, num, out result);
			num = HalconAPI.LoadI(proc, 1, num, out classID);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Add a training sample to the training data of a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="features">Feature vector of the training sample to be stored.</param>
		/// <param name="classID">Class of the training sample to be stored.</param>
		/// <param name="randomize">Standard deviation of the Gaussian noise added to the training data. Default: 0.0</param>
		// Token: 0x060002A3 RID: 675 RVA: 0x00010740 File Offset: 0x0000E940
		public void AddSampleClassGmm(HTuple features, int classID, double randomize)
		{
			IntPtr proc = HalconAPI.PreCall(1838);
			base.Store(proc, 0);
			HalconAPI.Store(proc, 1, features);
			HalconAPI.StoreI(proc, 2, classID);
			HalconAPI.StoreD(proc, 3, randomize);
			int procResult = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(features);
			HalconAPI.PostCall(proc, procResult);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Return the parameters of a Gaussian Mixture Model.
		///   Instance represents: GMM handle.
		/// </summary>
		/// <param name="numClasses">Number of classes of the GMM.</param>
		/// <param name="minCenters">Minimum number of centers per GMM class.</param>
		/// <param name="maxCenters">Maximum number of centers per GMM class.</param>
		/// <param name="covarType">Type of the covariance matrices.</param>
		/// <returns>Number of dimensions of the feature space.</returns>
		// Token: 0x060002A4 RID: 676 RVA: 0x00010794 File Offset: 0x0000E994
		public int GetParamsClassGmm(out int numClasses, out HTuple minCenters, out HTuple maxCenters, out string covarType)
		{
			IntPtr proc = HalconAPI.PreCall(1839);
			base.Store(proc, 0);
			HalconAPI.InitOCT(proc, 0);
			HalconAPI.InitOCT(proc, 1);
			HalconAPI.InitOCT(proc, 2);
			HalconAPI.InitOCT(proc, 3);
			HalconAPI.InitOCT(proc, 4);
			int num = HalconAPI.CallProcedure(proc);
			int result;
			num = HalconAPI.LoadI(proc, 0, num, out result);
			num = HalconAPI.LoadI(proc, 1, num, out numClasses);
			num = HTuple.LoadNew(proc, 2, HTupleType.INTEGER, num, out minCenters);
			num = HTuple.LoadNew(proc, 3, HTupleType.INTEGER, num, out maxCenters);
			num = HalconAPI.LoadS(proc, 4, num, out covarType);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
			return result;
		}

		/// <summary>
		///   Create a Gaussian Mixture Model for classification
		///   Modified instance represents: GMM handle.
		/// </summary>
		/// <param name="numDim">Number of dimensions of the feature space. Default: 3</param>
		/// <param name="numClasses">Number of classes of the GMM. Default: 5</param>
		/// <param name="numCenters">Number of centers per class. Default: 1</param>
		/// <param name="covarType">Type of the covariance matrices. Default: "spherical"</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "normalization"</param>
		/// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization'). Default: 10</param>
		/// <param name="randSeed">Seed value of the random number generator that is used to initialize the GMM with random values. Default: 42</param>
		// Token: 0x060002A5 RID: 677 RVA: 0x00010828 File Offset: 0x0000EA28
		public void CreateClassGmm(int numDim, int numClasses, HTuple numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1840);
			HalconAPI.StoreI(proc, 0, numDim);
			HalconAPI.StoreI(proc, 1, numClasses);
			HalconAPI.Store(proc, 2, numCenters);
			HalconAPI.StoreS(proc, 3, covarType);
			HalconAPI.StoreS(proc, 4, preprocessing);
			HalconAPI.StoreI(proc, 5, numComponents);
			HalconAPI.StoreI(proc, 6, randSeed);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			HalconAPI.UnpinTuple(numCenters);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}

		/// <summary>
		///   Create a Gaussian Mixture Model for classification
		///   Modified instance represents: GMM handle.
		/// </summary>
		/// <param name="numDim">Number of dimensions of the feature space. Default: 3</param>
		/// <param name="numClasses">Number of classes of the GMM. Default: 5</param>
		/// <param name="numCenters">Number of centers per class. Default: 1</param>
		/// <param name="covarType">Type of the covariance matrices. Default: "spherical"</param>
		/// <param name="preprocessing">Type of preprocessing used to transform the feature vectors. Default: "normalization"</param>
		/// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization'). Default: 10</param>
		/// <param name="randSeed">Seed value of the random number generator that is used to initialize the GMM with random values. Default: 42</param>
		// Token: 0x060002A6 RID: 678 RVA: 0x000108B0 File Offset: 0x0000EAB0
		public void CreateClassGmm(int numDim, int numClasses, int numCenters, string covarType, string preprocessing, int numComponents, int randSeed)
		{
			this.Dispose();
			IntPtr proc = HalconAPI.PreCall(1840);
			HalconAPI.StoreI(proc, 0, numDim);
			HalconAPI.StoreI(proc, 1, numClasses);
			HalconAPI.StoreI(proc, 2, numCenters);
			HalconAPI.StoreS(proc, 3, covarType);
			HalconAPI.StoreS(proc, 4, preprocessing);
			HalconAPI.StoreI(proc, 5, numComponents);
			HalconAPI.StoreI(proc, 6, randSeed);
			HalconAPI.InitOCT(proc, 0);
			int num = HalconAPI.CallProcedure(proc);
			num = base.Load(proc, 0, num);
			HalconAPI.PostCall(proc, num);
			GC.KeepAlive(this);
		}
	}
}
